 <#include "../common/com.html"/> <@layout>

<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />
<link href='${ctx}/static/assets/css/select2.css' media='all' rel='stylesheet' type='text/css'/>
<script src='${ctx}/static/assets/js/select2.min.js' type='text/javascript'></script>
<script src='${ctx}/static/assets/js/select2_locale_zh-CN.js' type='text/javascript'></script>
<script type="text/javascript">
	/**
	 * 新增
	 */
	function saveModel() {
		var card ='${(card)!}';
		var id = document.getElementById("id").value;
		if (Validator.Validate(document.getElementById('form1'))) {
		} else {
			return;
		}
		
		var	url = '${ctx}/xskd/update';
		$('#form1').form('submit', {
			url : url,
			onSubmit : function() {
				return $(this).form('validate');
			},
			success : function(data) {
				if(data!=0){
					alert("修改成功！");
					window.location.href = '${ctx}/xskd?card='+data;
				} else{
					alert("修改失败！");

				}
			}
		});

	}
</script>
<div class="page-content" style="overflow: hidden">
	<div class="row-fluid">
		<form class="form-horizontal" id="form1" method="post">
			<div class="span6">
				<input type="hidden" name="id" id="id">
				<div class="control-group">
					<label class="control-label">卡号:</label>
					<div class="controls">
						<input id="card" name="card" dataType="Require" msg="请输入卡号"
							type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">姓名:</label>
					<div class="controls">
						<input id="yhm" name="yhm" type="text" dataType="Require"
							msg="请输入姓名" style="min-height: 24px;" />
					</div>
				</div>

				<div class="control-group">
					<label class="control-label">固定电话:</label>
					<div class="controls">
						<input id="gddh" name="gddh" type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">手机:</label>
					<div class="controls">
						<input id="dh" name="dh" type="text" dataType="Require"
							msg="请输入手机号" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">微信号:</label>
					<div class="controls">
						<input id="wxh" name="wxh" type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">原始金额:</label>
					<div class="controls">
						<input id="ysje" name="ysje" dataType="Require" msg="请输入原始金额"
							type="text" style="min-height: 24px;" />
					</div>
				</div>


			</div>
			<div class="span6">
				<div class="control-group">
					<label class="control-label">会员卡分类:</label>
					<div class="controls">
						<input type="text"  name="hykfl" id="hykfl"  style="width: 200px; min-height: 24px;">
						<input id="ye" name="ye" type="hidden" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车型:</label>
					<div class="controls">
						<input id="cx" name="cx" type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车款:</label>
					<div class="controls">
						<input id="ck" name="ck" type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">车牌号:</label>
					<div class="controls">
						<input id="cph" name="cph" dataType="Require" msg="请输入车牌号"
							type="text" style="min-height: 24px;" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">保险日期:</label>
					<div class="controls">
						<input id="bxrq" name="bxrq" type="text"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate " />
					</div>
				</div>
<div class="control-group">
					<label class="control-label">年检日期:</label>
					<div class="controls">
						<input id="njrq" name="njrq" type="text"
							onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate " />
					</div>
				</div>

			</div>
			<div class="span12 center">
				<a class="btn btn-info btn-small" onclick="saveModel()">确定 </a>
				&nbsp; &nbsp;&nbsp;&nbsp; <a
					class="btn btn-danger btn-small bigger-110"
					onclick="window.location.href=' ${ctx}/xskd/'">取消 </a>
			</div>
		</form>

	</div>
</div>

</body>

<script>
	/**
	 * 修改页面使用
	 */
	 jQuery(function($) {
		 $('#hykfl').select2({
		        placeholder: "",
		        minimumInputLength: 0,
		        ajax: {
		            url:"${ctx}/common/comboTree/type='hykfl'?table=codes&fields=code as id,rmk as zk,name as text&pid=pid&pidStart=0&id=id"  ,
		            dataType: 'json',
		            data: function (term, page) {
		                return {
		                    term: term,
		                    page_limit: 50,
		                    page: 0,
		                    apikey: "gethykfl"
		                };
		            },
		            results: function (data, page) {
		           return { results: data};
		            }

		        }
		    });
		 
		 <#list newlist as m>
			  $("#hykfl").select2("data", {id: "${(m.hykfl)!}", text: "${(m.hykflmc)!}"});
			</#list>
		   });
	<#list newlist as m>
	document.getElementById("id").value = '${(m.id)!}';
	document.getElementById("card").value = '${(m.card)!}';
	document.getElementById("yhm").value = '${(m.yhm)!}';
	document.getElementById("gddh").value = '${(m.gddh)!}';
	document.getElementById("dh").value = '${(m.dh)!}';
	document.getElementById("wxh").value = '${(m.wxh)!}';
	document.getElementById("ysje").value = '${(m.ysje)!}';
	document.getElementById("ye").value = '${(m.ye)!}';
	document.getElementById("cx").value = '${(m.cx)!}';
	document.getElementById("ck").value = '${(m.ck)!}';
	document.getElementById("cph").value = '${(m.cph)!}';
	document.getElementById("bxrq").value = '${(m.bxrq)!}';
	document.getElementById("njrq").value = '${(m.njrq)!}';
	$("#ysje").attr("readonly","readonly");
	$("#ye").attr("readonly","readonly");
	$("#card").attr("readonly","readonly");

	</#list>
</script>
</@layout>
